<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../layui/jquery-3.2.1.min.js"></script>
    <script src="../layui/layui.js"></script>
    <script src="../layui/jquery.query.js"></script>
    <script src="js/purchaseStore.js"></script>
    <link href="../layui/css/layui.css" rel="stylesheet">
    <link href="css/purchaseStore.css" rel="stylesheet">
</head>
<body>
    <div class="layui-container">
        <h1 style="margin-left: 450px">采购入库</h1>
        <div class="layui-row">
            <div class="layui-col-md6">
                供应商：<select name="supplierName" id="supplierName">
            </select>
            </div>
            <div class="layui-col-md6">
                采购人：<span id="purchaseName"></span>
            </div>
        </div>
        <span>采购物品</span>
        <table class="layui-table">
            <thead><tr><th>商品名称</th><th>厂家</th><th>建议采购价</th><th>建议零售价</th><th>采购数量</th><th>操作</th></tr></thead>
            <tbody id="tableData"></tbody>
        </table>
        <div id="buttonDiv">
            <div class="layui-input-inline" style="display: flex;flex-direction: row">
                <a href="javascript:add()" class="layui-btn layui-btn-primary" style="margin-left: 420px; margin-right: 10px">添加商品</a>
                <a href="javascript:inputStore()" class="layui-btn layui-btn-primary" style="margin-left: 10px;">入库</a><div id="inError"></div>
            </div>
        </div>
    </div>

    <!--添加弹出层-->
    <div style="display: none" id="addDiv" class="layui-form">
        <form id="addForm" class="layui-form layui-inline" >
            <div class="layui-form-item">
                <label class="layui-form-label">商品编号</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="id" name="id" onblur="findById(this.value)" style="width: 150px;height: 30px" class="layui-input" placeholder="商品编号"><div id="idError"></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">商品名称</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="name" name="name" style="width: 150px;height: 30px" class="layui-input" placeholder="商品名称"><div id="nameError"></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">厂家</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="factory" name="factory" style="width: 150px;height: 30px" class="layui-input" placeholder="厂家"><div id="factoryError"></div>
                </div>
            </div>

            <div>
                <label class="layui-form-label">类别</label>
                <div class="layui-input-block">
                    <select id="type" name="type" >
                        <option value="电脑产品">电脑产品</option>
                        <option value="安防产品">安防产品</option>
                        <option value="打印扫描设备">打印扫描设备</option>
                        <option value="办公耗材">办公耗材</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">建议采购价</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="purchasePrice" name="purchasePrice" style="width: 150px;height: 30px" class="layui-input" placeholder="建议采购价"><div id="purchasePriceError"></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">建议销售价</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="salePrice" name="salePrice" style="width: 150px;height: 30px" class="layui-input" placeholder="建议销售价"><div id="salePriceError"></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">采购数量</label>
                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <input type="text" id="num" name="num" style="width: 150px;height: 30px" class="layui-input" placeholder="采购数量"><div id="numError"></div>
                </div>
            </div>

            <div class="layui-form-item">

                <div class="layui-input-inline" style="display: flex;flex-direction: row">
                    <img id="image" name="image" style="margin-left:100px;height: 100px;width: 100px"><div id="fileError"></div><br>
                </div>
                <input type="file" onchange="showImg(this.value)" >
            </div>
            <input type="reset" value="重置" id="reset" style="display: none">
            <a class="layui-btn layui-btn-normal" style="margin-left: 200px" href="javascript:addGoods()">添加</a>
        </form>
    </div>

    <!--入库弹出层-->
    <div style="display: none" id="inputStoreDiv">
        <p>入库成功</p><br>
        <a class="layui-btn layui-btn-normal"  href="javascript:clear()">确定</a>
    </div>
</body>
</html>